!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[GoogleMap]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[GoogleMap]"]=t(require("react")):e["rb_wixui.thunderbolt[GoogleMap]"]=t(e.React)}("undefined"!=typeof self?self:this,(function(e){return function(){var t={5329:function(t){"use strict";t.exports=e},448:function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t"undefined"!=typeof window,s=e=>Object.entries(e).reduce(((e,[t,n])=>(t.includes("data-")&&(e[t]=n),e)),{});const c="wixui-",u=(e,...t)=>{const n=[];return e&&n.push(`${c}${e}`),t.forEach((e=>{e&&(n.push(`${c}${e}`),n.push(e))})),n.join(" ")};const d=e=>e.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`)),p=(((e,t,n=[])=>{e.reduce(((e,t)=>({...e,[t]:!0})),{}),n.length})(["isSocialElementsBlocked"],(e=>{let{isSocialElementsBlocked:t}=e;return t?"WithConsentWrapper":void 0})),e=>({consentPolicy:e.currentConsentPolicy,openSettingModal:()=>e.openSettingModal([])}));var f={root:"google-map"};function g(){const e=n.useRef([]);return[n.useCallback((()=>new Promise((t=>e.current.push(t)))),[]),n.useCallback((t=>{e.current.forEach((e=>e(t))),e.current.length=0}),[])]}const m=(e,t)=>{if(e||t)return t?{path:e,fillColor:t,strokeColor:t,fillOpacity:1,scale:.5}:(e=>{if(e&&e.endsWith(".webp"))try{const t=e.match(/media\/[^/]+/)[0].split(".")[1];e=e.replace(/.webp$/,"."+t)}catch(e){}return e})(e)},v=(e,t)=>e.map((e=>({...e,icon:m(e.pinIcon,e.pinColor)||t&&m(t.pinIcon,null==t?void 0:t.pinColor)})));var y="load",h="message",M="SET_INITIAL_LOCATIONS",E="SET_CENTER",S="CENTER_UPDATED",w="SET_ZOOM",C="ZOOM_UPDATED",b="MARKER_CLICKED",O="MAP_CLICKED",_="GET_MARKERS",k="MARKERS",N="FIT_BOUNDS",I="MAP_IDLE",L="OPEN_INFO_WINDOW",x="TILES_LOADED",D="SET_MARKER_ICON",R="SET_MARKER_ICON_FINISHED",P="SET_DIRECTION";const j=["iw","ar","ur","fa"];function T(e,t,o){let{mapData:r,language:a,isEditorMode:i}=t,{onUpdateZoom:s,onUpdateCenter:c,onMarkerClicked:u,onMapClicked:d}=o;const p=(0,n.useRef)([]),f=(0,n.useRef)(null),m=(0,n.useMemo)((()=>{var e,t,n,o;return void 0!==r.defaultLocation?{pinIcon:null!=(e=null==(t=r.locations[r.defaultLocation])?void 0:t.pinIcon)?e:"",pinColor:null!=(n=null==(o=r.locations[r.defaultLocation])?void 0:o.pinColor)?n:""}:void 0}),[r.defaultLocation,r.locations]),[T,A]=g(),[F,G]=g(),[U,W]=g(),[J,K]=g(),[B,Z]=g(),[$,q]=g(),[H,z]=g(),[V,Q]=(0,n.useState)(!1),X=(e,t)=>{const n=f.current;return v(n||e,t)},Y=(0,n.useMemo)((()=>({...r,locations:X(r.locations,m)})),[r,m]),ee=function(e,t){void 0===t&&(t=null);const o=(0,n.useRef)(t);return(0,n.useEffect)((()=>{o.current=e}),[e]),o.current}(Y),te={[S]:e=>null==c?void 0:c(e),[C]:e=>null==s?void 0:s({zoom:e}),[b]:e=>null==u?void 0:u({type:"markerClicked",...e}),[O]:e=>{let{longitude:t,latitude:n,...o}=e;return null==d?void 0:d({type:"mapClicked",location:{longitude:t,latitude:n},...o})},[k]:e=>A(e),[I]:()=>{const e=p.current.shift();null==e||e()},[x]:()=>{V||Q(!0)},[R]:()=>z()},ne={[y]:e=>{let{_sendMessage:t}=e;t({type:M,data:JSON.stringify({...r,locations:X(r.locations)})},{forceSend:!0}),t({type:P,data:JSON.stringify({direction:j.includes(a)?"rtl":"ltr"})})},[h]:e=>{let{event:t}=e;if("string"==typeof t.payload){var n;const{type:e,data:o}=JSON.parse(t.payload);null==(n=te[e])||n.call(te,o)}}},[oe,re]=function(e){let{reducer:t=(()=>({})),iframeLoaded:o}=e;const r=(0,n.useRef)([]),a=(0,n.useRef)(void 0),i=(0,n.useRef)(void 0),s=(0,n.useRef)(void 0),c=(0,n.useCallback)(((e,t)=>{if(a.current&&o||null!=t&&t.forceSend){var n;const t=null==(n=a.current)?void 0:n.contentWindow;return void(null==t||t.postMessage(e,"*"))}if(!a.current||!i.current||!1===o)return void r.current.push(e);const l=a.current.contentWindow;null==l||l.postMessage(e,"*")}),[o]),u=(0,n.useCallback)((()=>{0!==r.current.length&&!1!==o&&(r.current.forEach((e=>c(e))),r.current=[])}),[c,o]),d=(0,n.useCallback)((e=>{if(s.current&&(s.current(),s.current=void 0),!e)return;const n=()=>{i.current=!0,u(),t({type:"load"},c)};e.addEventListener("load",n),a.current=e,s.current=()=>{e.removeEventListener("load",n)}}),[t,c,u]);return(0,n.useEffect)((()=>{o&&u()}),[o,u]),(0,n.useEffect)((()=>{if(!l())return;const e=e=>{var n;e.source&&e.source!==(null==(n=a.current)?void 0:n.contentWindow)||t({type:"message",payload:e.data},c)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}),[t,c]),[d,c]}({reducer:(e,t)=>{var n;return null==(n=ne[e.type])?void 0:n.call(ne,{event:e,_sendMessage:t})},iframeLoaded:V});return(0,n.useImperativeHandle)(e,(()=>({setMapCenter:(e,t)=>{const n=F();return re({type:E,data:JSON.stringify({longitude:e,latitude:t})}),p.current.push(G),n},fitBounds:e=>{let{north:t,east:n,west:o,south:r}=e;const a=J();return re({type:N,data:JSON.stringify({north:t,east:n,west:o,south:r})}),p.current.push(K),a},setMarkerIcon:e=>{let{locations:t,coordinates:n,iconOptions:o}=e;const r=H();return f.current=t,re({type:D,data:JSON.stringify({...n,iconOptions:o})}),r},setMapZoom:e=>{const t=U();return re({type:w,data:e}),p.current.push(W),t},getVisibleMarkers:()=>{const e=T();return re({type:_}),e},openInfoWindow:e=>{if(!Y.showDirectionsLink){const t=$();return re({type:L,data:JSON.stringify({locationIndex:e})}),p.current.push(q),t}return new Promise((e=>e()))},setMarkers:(e,t)=>{const n=B();return f.current=e,re(JSON.stringify({...Y,locations:v(e,m),openInfoWindow:null==t?void 0:t.openInfoWindow})),p.current.push(Z),n}}))),(0,n.useEffect)((()=>{if(!V||!i)return;const e=!!ee&&(t=Y.locations,n=ee.locations,t.length===n.length&&t.every(((e,t)=>{const o=Object.keys(e);return o.length===Object.keys(n[t]).length&&o.every((o=>"locationLinkAttributes"===o||e[o]===n[t][o]))})));var t,n;re(JSON.stringify({...Y,locations:X(Y.locations,m),shouldKeepMarkers:e}))}),[Y,re,m,V,ee,i]),[oe]}var A={GoogleMapSkin:"c36GfP",googleMapSkin:"c36GfP",mapContainer:"gwyB6z",GoogleMapDefault:"qFjBwF",googleMapDefault:"qFjBwF",GoogleMapSloppy:"D_LINF",googleMapSloppy:"D_LINF",brd:"J8D75x",one:"KH6hFC",two:"Czan88",GoogleMapLiftedShadow:"sp0Pug",googleMapLiftedShadow:"sp0Pug",shd:"gDJxCg",left:"H78pyp",right:"QvNeFb"};const F={GoogleMapLiftedShadow:()=>n.createElement(n.Fragment,null,n.createElement("div",{className:i(A.left,A.shd)}),n.createElement("div",{className:i(A.right,A.shd)})),GoogleMapSloppy:()=>n.createElement(n.Fragment,null,n.createElement("div",{className:i(A.brd,A.one)}),n.createElement("div",{className:i(A.brd,A.two)})),GoogleMapSkin:()=>n.createElement(n.Fragment,null),GoogleMapDefault:()=>n.createElement(n.Fragment,null)};var G=o.p+"media/googleMap.ea5928de.html",U=o.p+"media/google-map.min.c5cac041.js";const W=e=>e.replace("https://static.parastorage.com/services/","https://editor.wix.com/_partials/"),J=(e,o)=>{const{id:r,className:a,customClassNames:c=[],skin:d,urlQueries:p,mapData:g,translations:m,isConsentPolicyActive:v,onUpdateCenter:y,onUpdateZoom:h,onMarkerClicked:M,onMapClicked:E,onMouseEnter:S,onMouseLeave:w,isDesignerMode:C,isEditorMode:b,language:O}=e,_=F[d],k=((e,t)=>{const n=t?W(U):U,o=new URLSearchParams({googleMapsScriptPath:new URL(n).pathname});return l()&&o.append("origin",window.origin),(t?W(G):G)+"?"+e+"&"+o})(p,C),[N,I]=n.useState(!1),[L]=T(o,{mapData:g,isEditorMode:b,language:O},{onUpdateCenter:y,onUpdateZoom:h,onMarkerClicked:M,onMapClicked:E});n.useEffect((()=>{I(!0)}),[k]);const x=m.title,D=((e,t)=>e?{}:t)(v,{id:r,className:i(A[d],A.wixIframe,a,u(f.root,...c)),...s(e)});return n.createElement("div",t()({},D,{tabIndex:0}),N&&n.createElement("wix-iframe",{title:x,"aria-label":x,"data-src":k},n.createElement(_,null),n.createElement("div",{id:"mapContainer_"+r,onMouseEnter:S,onMouseLeave:w,className:A.mapContainer},n.createElement("iframe",{ref:L,title:x,"aria-label":x,"data-src":k,width:"100%",height:"100%",frameBorder:"0",scrolling:"no",allowFullScreen:!0}))))};var K;const B={GoogleMap:{component:n.forwardRef(J),controller:(K=e=>{let{stateValues:t,mapperProps:n}=e;return{...n,...p(t)}},{useComponentProps:(e,t,n)=>{const o=(e=>({...e,updateStyles:t=>{const n=Object.entries(t).reduce(((e,[t,n])=>{return{...e,[(o=t,o.startsWith("--")?t:d(t))]:void 0===n?null:n};var o}),{});e.updateStyles(n)}}))(n);return K({mapperProps:e,stateValues:t,controllerUtils:o})}})}}}(),r}()})); //# sourceMappingURL=https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/rb_wixui.thunderbolt[GoogleMap].bb6c6729.bundle.min.js.map